<?php

/**
 * JingYao-backend
 *
 * @link     https://gitee.com/wang-zhihui-release/jingyao-backend
 * @apiDocument https://gitee.com/wang-zhihui-release/jingyao-backend/wikis/
 */

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateAdminLogsTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up()
    {
        Schema::create('admin_logs', function (Blueprint $table) {
            $table->id();
            $table->string('ip')->nullable()->default('');
            $table->integer('user_id')->default(0);
            $table->integer('user_role')->default(0);
            $table->string('message')->nullable();
            $table->tinyInteger('exec_type')->default(0)->comment('操作类型 1增加 2删除 3修改 4查询');
            $table->string('table', 100)->nullable();
            $table->integer('exec_time')->comment('操作时间');
            $table->timestamps();
            $table->index('user_id');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down()
    {
        Schema::dropIfExists('admin_logs');
    }
}
